pkg_check_modules(LIBVNC QUIET libvncclient)

set(PROTOCOLS "a12")
set(SRCS
	${CMAKE_CURRENT_SOURCE_DIR}/remoting.c
	${CMAKE_CURRENT_SOURCE_DIR}/a12.c
	${CMAKE_CURRENT_SOURCE_DIR}/../../util/anet_helper.c
	${CMAKE_CURRENT_SOURCE_DIR}/../../util/anet_keystore_naive.c
)

set(LIBS arcan_a12)
set(INCS ${PLATFORM_ROOT}/../a12)

if (LIBVNC_FOUND)
	set(PROTOCOLS "${PROTOCOLS} vnc")
	list(APPEND SRCS
		${CMAKE_CURRENT_SOURCE_DIR}/vnc.c
	)
	list(APPEND LIBS
		${LIBVNC_LINK_LIBRARIES}
	)
	list(APPEND INCS
		${LIBVNC_INCLUDE_DIRS})
	set(REMOTING_DEFS
		ENABLE_VNC
		PARENT_SCOPE
	)
endif()

set(REMOTING_SOURCES ${SRCS} PARENT_SCOPE)
set(REMOTING_LIBS ${LIBS} PARENT_SCOPE)
set(REMOTING_INCLUDE_DIRS ${INCS} PARENT_SCOPE)

amsg("${CL_YEL}remoting support:\t${CL_GRN}${PROTOCOLS}${CL_RST}")
